//
//  UIView+exclusiveTouch.m
//  HWTV
//
//  Created by yangyuhe on 16/11/2.
//  Copyright © 2016年 yijie. All rights reserved.
//

#import "UIView+exclusiveTouch.h"

@implementation UIView (exclusiveTouch)
- (BOOL)isExclusiveTouch
{
    return YES;
}

- (UIView *)childViewWithClass:(Class)specifiedClass
{
    for (UIView *childView in self.subviews)
    {
        if ([childView isKindOfClass:specifiedClass])
        {
            return childView;
        }
        else if ([childView childViewWithClass:specifiedClass])
        {
            return [childView childViewWithClass:specifiedClass];
        }
    }
    return nil;
}

- (UIViewController *)stayViewController
{
    UIResponder *next = [self nextResponder];
    do {
        if ([next isKindOfClass:[UIViewController class]]) {
            return (UIViewController *)next;
        }
        next = [next nextResponder];
    } while (next != nil);
    return nil;
}
@end
